bool isValidSudoku(char** board, int boardSize, int* boardColSize) {
    bool rowUsed[9][9] = {false};
    bool colUsed[9][9] = {false};
    bool boxUsed[9][9] = {false};

    for (int row = 0; row < boardSize; row++) {
        for (int col = 0; col < boardColSize[0]; col++) {
            if (board[row][col] != '.') {
                int num = board[row][col] - '1';

                // 检查行
                if (rowUsed[row][num]) {
                    return false;
                } else {
                    rowUsed[row][num] = true;
                }
                // 检查列
                if (colUsed[col][num]) {
                    return false;
                } else {
                    colUsed[col][num] = true;
                }
                // 检查子数独
                int boxIndex = (row / 3) * 3 + col / 3;
                if (boxUsed[boxIndex][num]) {
                    return false;
                } else {
                    boxUsed[boxIndex][num] = true;
                }
            }
        }
    }
    return true;
}